package com.tl.commonlibrary.network.bean.base;

import android.text.TextUtils;

import java.io.Serializable;

/**
 * Created by Administrator on 2017/6/9 0009.
 * 服务器端数据返回的最外层结构
 */

public class BaseBean<T> implements Serializable {
    public static final String SUCCESS = "0";
    public static final String TOKEN_INVALID = "1001";
    public String code;
    public String msg;
    public T data;

    public boolean isSuccessful() {
        if (TextUtils.isEmpty(code)) {
            return false;
        }
        return SUCCESS.equalsIgnoreCase(code);
    }

    public boolean isTokenInvalid() {
        if (TextUtils.isEmpty(code)) {
            return false;
        }
        return TOKEN_INVALID.endsWith(code) || "100801".endsWith(code);
    }
}
